﻿using KeYan.Service.Common.Enum;
using KeYan.Service.IRepository.UserLogin;
using KeYan.Service.IService.UserLogin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KeYan.Service.Service.UserLogin
{
    public class UserService : IUserService
    {
        private readonly IUserRepository _repository;
        private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
        public UserService(IUserRepository repository)
        {
            _repository = repository;
        }

        /// <summary>
        /// ids4登录
        /// </summary>
        /// <param name="LoginName"></param>
        /// <param name="LoginPwd"></param>
        /// <returns></returns>
        public Task<Resilt<string>> GetIdsTokenAsync(string LoginName, string LoginPwd)
        {
            try
            {
                return _repository.GetIdsLogin(LoginName, LoginPwd);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                throw;
            }

        }

        public Task<Resilt<int>> PhoneLogin(string Tel, string Pwd)
        {
            try
            {
                return _repository.PhoneLogin(Tel, Pwd);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                throw;
            }

        }
    }
}